package com.yeung.exam;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class 合唱队型 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = sc.nextInt();
        List<Integer> peoples = new ArrayList<>();
        int index = 0;
        while (index < count) {
            peoples.add(sc.nextInt());
            index++;
        }
        //开始分组
        List<List<Integer>> result = new ArrayList<>();

        while (peoples.size() > 0) {
            int low = 0;
            boolean isf = true;
            int i = 0;
            for (; i < peoples.size() - 1; i++) {
                int pre = peoples.get(i);
                int nex = peoples.get(i + 1);
                if (pre <= nex && isf) {
                    low = i;
                    isf = false;
                }
                if(pre>nex) break;
            }
//                    if (i - low == 0) continue;//只有一个元素
            //遇到拐点了, 拿出此段
            ArrayList<Integer> tmp = new ArrayList<>();
            for (int k = low; k <= i; k++) {
                tmp.add(peoples.get(k));
                peoples.set(k, -1);//-1表示删除
            }
            result.add(tmp);
        }
        //删除为-1的元素
        peoples.removeIf(ite -> ite == -1);
        System.out.println(result.size());
    }

}
